package com.yylany.controller;

import com.yylany.service.GoodsInfoService;
import com.yylany.vo.GoodsInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * Description: pinyougou
 *
 * @author <a href="mailto:17777502615@163.com">yaoyonglong</a>
 * @date 2019/1/2
 * @since 1.0.0
 */
@RestController
@RequestMapping
public class GoodsInfoController {

    @Autowired
    private GoodsInfoService service;

    @GetMapping("goods/{skuid}")
    public ResponseEntity<HashMap<String, GoodsInfo>> goods(@PathVariable(name = "skuid") Integer skuid) {
        GoodsInfo info = service.getGoodInfo(skuid);
        HashMap<String, GoodsInfo> map = new HashMap<>();
        map.put("data", info);
        return ResponseEntity.ok(map);
    }

}
